#include <compare>
#include <fmt/format.h>
#include <iostream>
#include <string>

class MyTime
{
public:
    MyTime(int hr, int min, int sec) noexcept : m_hr(hr), m_min(min), m_sec(sec) {}
    std::string toString() const { return fmt::format("hr={},min={},sec={}", m_hr, m_min, m_sec); }
    auto operator<=>(const MyTime &t) const noexcept = default;

private:
    int m_hr{ 0 };
    int m_min{ 0 };
    int m_sec{ 0 };
};
int main()
{
    const MyTime t1(12, 14, 19);
    const MyTime t2(12, 15, 19);
    const MyTime t3(6, 30, 0);
    std::cout << fmt::format("t1: {}\nt2: {}\nt3: {}\n", t1.toString(), t2.toString(), t3.toString());

    std::cout << fmt::format("t1 == t2? {}\n", t1 == t2);

    if ((t1 <=> t2) > 0)
    {
        std::cout << fmt::format("t1 > t2? {}\n", t1 > t2);
    }
    else
    {
        std::cout << fmt::format("t1 < t2? {}\n", t1 < t2);
    }
    return 0;
}